package com.ash.unirest;

import com.google.common.util.concurrent.RateLimiter;

public class Test {

    public static void main(String[] args) throws Exception {
        testRateLimit2();

    }

    private static void testRateLimit1() {
        RateLimiter rateLimiter = RateLimiter.create(1000);
        int i = 0;
        while (true) {
            rateLimiter.acquire();
            i++;

        }
    }

    private static void testRateLimit2() {
        RateLimiter rateLimiter = RateLimiter.create(1000);
        int i = 0;
        while (true) {
            if (rateLimiter.tryAcquire()) {
                i++;
            }
        }
    }
}
